<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="StringUtil,sandy.util.StringUtil,clear,clearRepeat,findBlockIndex,getBlockByIndex,getBlockRange,getBlocks,getTextBetween,indexTimes,replace" name="keywords">
<title>sandy.util.StringUtil</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'StringUtil - Sandy 3.1.2 API Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Sandy 3D Engine, 3.1.2</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?sandy/util/StringUtil.html&amp;sandy/util/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;StringUtil</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class StringUtil"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">sandy.util</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class StringUtil</td>
</tr>
</table>
<p></p>
  Utility class for string manipulation.
   
  <p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#clear()">clear</a>(p_sStr:String, p_aExpand:Array):String</div>
<div class="summaryTableDescription">[static]
   Strips &quot;\r&quot; and &quot;\n&quot; characters from a string and removes consecutive spaces.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#clearRepeat()">clearRepeat</a>(p_sStr:String, p_sRepeat:String, p_sReplace:String = ""):String</div>
<div class="summaryTableDescription">[static]
   Clears the source string from multiple occurences of a pattern.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#findBlockIndex()">findBlockIndex</a>(p_sStr:String, p_sStart:String, p_sEnd:String):Array</div>
<div class="summaryTableDescription">[static]
   Returns pairs of start and end indices of a block in a source string.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getBlockByIndex()">getBlockByIndex</a>(p_sStr:String, p_aPairs:Array, p_nIndex:Number, p_bNoSymbol:Boolean):String</div>
<div class="summaryTableDescription">[static]
   Returns a specific sub string of the source string.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getBlockRange()">getBlockRange</a>(p_aPairs:Array, p_nIndex:Number):Array</div>
<div class="summaryTableDescription">[static]
   Returns the start and end indices for a substring, analyzed by findBlockIndex.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getBlocks()">getBlocks</a>(p_sStr:String, p_aPairs:Array, p_bWithSymbol:Boolean):Array</div>
<div class="summaryTableDescription">[static]
   Returns all blocks between start and end indices from a source string.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getTextBetween()">getTextBetween</a>(p_sStr:String, p_sStart:String, p_sEnd:String):Array</div>
<div class="summaryTableDescription">[static]
   Returns all sub strings in a string between two given delimiter patterns.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#indexTimes()">indexTimes</a>(p_sStr:String, p_sSubstr:String, p_nOccur:Number, p_nStart:Number):Number</div>
<div class="summaryTableDescription">[static]
   Returns the index of the Nth occurance of sub string.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#replace()">replace</a>(p_sStr:String, p_sOld:String, p_sNew:String):String</div>
<div class="summaryTableDescription">[static]
   Replaces a sub string with another in the target string.</div>
</td><td class="summaryTableOwnerCol">StringUtil</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="clear()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">clear</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function clear(p_sStr:String, p_aExpand:Array):String</code><p>
   Strips &quot;\r&quot; and &quot;\n&quot; characters from a string and removes consecutive spaces.
      </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash; The string to modify.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_aExpand</span>:Array</code> &mdash; Other strings you want to clear out.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash;   The modified string.
   </td>
</tr>
</table>
</div>
<a name="clearRepeat()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">clearRepeat</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function clearRepeat(p_sStr:String, p_sRepeat:String, p_sReplace:String = ""):String</code><p>
   Clears the source string from multiple occurences of a pattern.
      </p><p>Ex: If you want to clear "ababab", you can use "ab" as a pattern.</p> 
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash;  The pattern to clear out.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sRepeat</span>:String</code> &mdash; Replace chars, default is a space.
      </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sReplace</span>:String</code> (default = "<code></code>")<code></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash;   The modified string.
   </td>
</tr>
</table>
</div>
<a name="findBlockIndex()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">findBlockIndex</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function findBlockIndex(p_sStr:String, p_sStart:String, p_sEnd:String):Array</code><p>
   Returns pairs of start and end indices of a block in a source string.
      </p><p>The target string is searched for blocks of text between a start and and an end delimiter string.<br/>
   The start and end indices into the searched string, for each found block is stored in a two dimensional array.<br />
   All inices are returned as an array of index pairs.</p>
      <p>array struct:</p>
   <p>array[0] = [Block_Start_String_Length, Block_End_String_Length]</p>
   <p>array[1] = [Start_Index_1, End_Index_1]</p>
   <p>array[x] = [Start_Index_x, End_Index_x]</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash;  The string to search.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sStart</span>:String</code> &mdash;  Block start with.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sEnd</span>:String</code> &mdash;  Block end with.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Array</code> &mdash;  An array containtng all the start and end indices.
   </td>
</tr>
</table>
</div>
<a name="getBlockByIndex()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getBlockByIndex</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getBlockByIndex(p_sStr:String, p_aPairs:Array, p_nIndex:Number, p_bNoSymbol:Boolean):String</code><p>
   Returns a specific sub string of the source string.
      </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash;  The string to search.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_aPairs</span>:Array</code> &mdash;  Index pairs created by findBlockIndex.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nIndex</span>:Number</code> &mdash;  Start index into the string of the block to search for.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_bNoSymbol</span>:Boolean</code> &mdash; Do not include start and end symbols.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash;  The searched sub string or an empty string if not found.
   </td>
</tr>
</table>
</div>
<a name="getBlockRange()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getBlockRange</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getBlockRange(p_aPairs:Array, p_nIndex:Number):Array</code><p>
   Returns the start and end indices for a substring, analyzed by findBlockIndex.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_aPairs</span>:Array</code> &mdash; Index pairs created by findBlockIndex.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nIndex</span>:Number</code> &mdash; Start index into the string of the block of interest.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Array</code> &mdash;  The pair of start and end indices, [-1, -1] if not found.
   </td>
</tr>
</table>
</div>
<a name="getBlocks()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getBlocks</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getBlocks(p_sStr:String, p_aPairs:Array, p_bWithSymbol:Boolean):Array</code><p>
   Returns all blocks between start and end indices from a source string.
      </p><p>Given an array of index pairs, normally created by a call to findBlockIndex,
   all blocks between index pairs are extracted and stored in an array</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash;  The string to search.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_aPairs</span>:Array</code> &mdash;  Index pairs created by findBlockIndex.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_bWithSymbol</span>:Boolean</code> &mdash; Include start and end symbols if set to true.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Array</code> &mdash;   All blocks between the start and end indices.
   </td>
</tr>
</table>
</div>
<a name="getTextBetween()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getTextBetween</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function getTextBetween(p_sStr:String, p_sStart:String, p_sEnd:String):Array</code><p>
   Returns all sub strings in a string between two given delimiter patterns.
   
   </p><p>The delimiters are not included in the results.</p>
      <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash; The string to search.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sStart</span>:String</code> &mdash; The start delimiter.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sEnd</span>:String</code> &mdash; The end delimiter.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Array</code> &mdash;   An array of found sub strings. Empty if no matching patterns were found.
   </td>
</tr>
</table>
</div>
<a name="indexTimes()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">indexTimes</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function indexTimes(p_sStr:String, p_sSubstr:String, p_nOccur:Number, p_nStart:Number):Number</code><p>
   Returns the index of the Nth occurance of sub string.
      </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash; The string to search.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sSubstr</span>:String</code> &mdash; Sub string you want find.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nOccur</span>:Number</code> &mdash; The occurance of the sub string to find.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_nStart</span>:Number</code> &mdash; Start index for the search.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash;  Start index of the search sub string.
   </td>
</tr>
</table>
</div>
<a name="replace()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">replace</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function replace(p_sStr:String, p_sOld:String, p_sNew:String):String</code><p>
   Replaces a sub string with another in the target string.
      </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">p_sStr</span>:String</code> &mdash;  The string to modify.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sOld</span>:String</code> &mdash;  The pattern to replace.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">p_sNew</span>:String</code> &mdash;  What to replace the pattern with.
      </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>String</code> &mdash;   The modified string.
   </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">API documentation for Sandy 3D Engine, Ver. 3.1.2</center>
</div>
</body>
</html>
<!--API documentation for Sandy 3D Engine, Ver. 3.1.2-->
